<%@page pageEncoding="utf-8" contentType="text/html; charset=utf-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
	<head>
		<meta http-equiv=Content-Type content="text/html; charset=utf-8" />
		<link href="css/main/style.css"
			type="text/css" rel="stylesheet" />
		<script type="text/javascript">
			function strip(str){
				//g表示匹配整个字符串
				var reg=/(^\s*)|(\s*$)/g;
				return str.replace(reg,'');
			}
			//alert(strip(' abc ').length);
			function modify(id,qty){
				if(strip(qty).length==0){
					alert('数量不能为空');
					return;
				}
				//qty必须为数字
				var reg=/^[0-9]+$/;
				if(!reg.test(strip(qty))){
				alert('必须是数字');
				return;
				}
				location='modify.do?id='+id+'&qty='+strip(qty);
			}
		</script>
		<script type="text/javascript" src="js/changeMount.js"></script>
		<script type="text/javascript" src="js/delete.js"></script>
	</head>

	<body topMargin="10">
		<div id="append_parent"></div>
		<table cellSpacing="6" cellPadding="2" width="100%" border="0">
			<tbody>
				<tr>
					<td>
						<table class="guide" cellSpacing="0" cellPadding="0" width="100%"
							border="0">
							<tbody>
								<tr>
									<td>
										<a href='#'>主页</a>&nbsp;/&nbsp;
										<a href='computer_list.html'>
										笔记本订购(WEB007)</a>&nbsp;/&nbsp;购物车信息
									</td>
								</tr>
							</tbody>
						</table>
						<br />

						<table class="tableborder" cellSpacing="0" cellPadding="0"
							width="100%" border="0">
							<tbody>
								<tr class="header">
									<td class="altbg2" colspan="6">
										购物车信息
									</td>
								</tr>
							<tbody>
								<tr>
									<td class="altbg1" width="20%">
										<b>型号</b>
									</td>
									<td class="altbg1" width="20%">
										<b>价格</b>
									</td>
									<td class="altbg1" width="10%">
										<b>数量</b>
									</td>
									<td class="altbg1" width="30">
										&nbsp;
									</td>
									<td class="altbg1" width="10%">
										&nbsp;
									</td>
									<td class="altbg1">
										&nbsp;
									</td>
								</tr>
							</tbody>
							<c:forEach items="${carlist}" var="cg" varStatus="status">
									<tr>
										<td name="xinghao">${cg.xinghao }</td>
										<td>${cg.jiage }</td>
										<td>${cg.mount }</td>
										<td><input name="shuliang" type="text"></td>
										<td><a href="#" onclick="changeAmount(${status.index})">更改数量</a></td>
										<td><a href="#" onclick="deleteThis(${status.index})">删除</a></td>
									</tr>
							</c:forEach>
							<tr>
								<td colspan="6">总价格：￥   ${allMoney }</td>
							</tr>
						</table>

						<br />
						<center>
							<a href="servlet"><input class="button" type="button" value="返回商品列表"
								name="settingsubmit" onclick=""></a>
							<input class="button" type="button" value="清空购物车"
								name="settingsubmit" onclick="deleteAll()">
						</center>
					</td>
				</tr>
			</tbody>
		</table>
	</body>
</html>



